SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwcarlitos
AS
SELECT DISTINCT TOP 100 PERCENT Agente, MAX(CUISE) AS Expr1
FROM         dbo.vw_POFPaquetes inner join tb_suborganizaciones on suborganizacion = descripcion --inner join tb_suborganizaciones on 
WHERE     (Agente <> 'vacante') AND (Licencia IS NULL) AND (CUISE > 300)
GROUP BY Agente
ORDER BY MAX(CUISE)

GO
GRANT SELECT ON  [dbo].[vwcarlitos] TO [SoloVer]
GO
